(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, n^2).


The TRS R consists of the following rules:

p(0) → s(s(0))
p(s(x)) → x
p(p(s(x))) → p(x)
le(p(s(x)), x) → le(x, x)
le(0, y) → true
le(s(x), 0) → false
le(s(x), s(y)) → le(x, y)
minus(x, y) → if(le(x, y), x, y)
if(true, x, y) → 0
if(false, x, y) → s(minus(p(x), y))

Rewrite Strategy: INNERMOST

(1) NestedDefinedSymbolProof (BOTH BOUNDS(ID, ID) transformation)

The following defined symbols can occur below the 0th argument of minus: p, le
The following defined symbols can occur below the 0th argument of le: p, le
The following defined symbols can occur below the 0th argument of if: le, p
The following defined symbols can occur below the 1th argument of if: p, le

Hence, the left-hand sides of the following rules are not basic-reachable and can be removed:
p(p(s(x))) → p(x)

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, n^2).


The TRS R consists of the following rules:

p(0) → s(s(0))
if(false, x, y) → s(minus(p(x), y))
minus(x, y) → if(le(x, y), x, y)
le(s(x), s(y)) → le(x, y)
p(s(x)) → x
le(s(x), 0) → false
le(p(s(x)), x) → le(x, x)
le(0, y) → true
if(true, x, y) → 0

Rewrite Strategy: INNERMOST

(3) CpxTrsToCdtProof (BOTH BOUNDS(ID, ID) transformation)

Converted Cpx (relative) TRS to CDT

(4) Obligation:

Complexity Dependency Tuples Problem
Rules:

p(0) → s(s(0))
p(s(z0)) → z0
if(false, z0, z1) → s(minus(p(z0), z1))
if(true, z0, z1) → 0
minus(z0, z1) → if(le(z0, z1), z0, z1)
le(s(z0), s(z1)) → le(z0, z1)
le(s(z0), 0) → false
le(p(s(z0)), z0) → le(z0, z0)
le(0, z0) → true
Tuples:

P(0) → c
P(s(z0)) → c1
IF(false, z0, z1) → c2(MINUS(p(z0), z1), P(z0))
IF(true, z0, z1) → c3
MINUS(z0, z1) → c4(IF(le(z0, z1), z0, z1), LE(z0, z1))
LE(s(z0), s(z1)) → c5(LE(z0, z1))
LE(s(z0), 0) → c6
LE(p(s(z0)), z0) → c7(LE(z0, z0))
LE(0, z0) → c8
S tuples:

P(0) → c
P(s(z0)) → c1
IF(false, z0, z1) → c2(MINUS(p(z0), z1), P(z0))
IF(true, z0, z1) → c3
MINUS(z0, z1) → c4(IF(le(z0, z1), z0, z1), LE(z0, z1))
LE(s(z0), s(z1)) → c5(LE(z0, z1))
LE(s(z0), 0) → c6
LE(p(s(z0)), z0) → c7(LE(z0, z0))
LE(0, z0) → c8
K tuples:none
Defined Rule Symbols:

p, if, minus, le

Defined Pair Symbols:

P, IF, MINUS, LE

Compound Symbols:

c, c1, c2, c3, c4, c5, c6, c7, c8

(5) CdtLeafRemovalProof (ComplexityIfPolyImplication transformation)

Removed 1 leading nodes:

LE(p(s(z0)), z0) → c7(LE(z0, z0))
Removed 5 trailing nodes:

P(s(z0)) → c1
LE(0, z0) → c8
P(0) → c
LE(s(z0), 0) → c6
IF(true, z0, z1) → c3

(6) Obligation:

Complexity Dependency Tuples Problem
Rules:

p(0) → s(s(0))
p(s(z0)) → z0
if(false, z0, z1) → s(minus(p(z0), z1))
if(true, z0, z1) → 0
minus(z0, z1) → if(le(z0, z1), z0, z1)
le(s(z0), s(z1)) → le(z0, z1)
le(s(z0), 0) → false
le(p(s(z0)), z0) → le(z0, z0)
le(0, z0) → true
Tuples:

IF(false, z0, z1) → c2(MINUS(p(z0), z1), P(z0))
MINUS(z0, z1) → c4(IF(le(z0, z1), z0, z1), LE(z0, z1))
LE(s(z0), s(z1)) → c5(LE(z0, z1))
S tuples:

IF(false, z0, z1) → c2(MINUS(p(z0), z1), P(z0))
MINUS(z0, z1) → c4(IF(le(z0, z1), z0, z1), LE(z0, z1))
LE(s(z0), s(z1)) → c5(LE(z0, z1))
K tuples:none
Defined Rule Symbols:

p, if, minus, le

Defined Pair Symbols:

IF, MINUS, LE

Compound Symbols:

c2, c4, c5

(7) CdtRhsSimplificationProcessorProof (BOTH BOUNDS(ID, ID) transformation)

Removed 1 trailing tuple parts

(8) Obligation:

Complexity Dependency Tuples Problem
Rules:

p(0) → s(s(0))
p(s(z0)) → z0
if(false, z0, z1) → s(minus(p(z0), z1))
if(true, z0, z1) → 0
minus(z0, z1) → if(le(z0, z1), z0, z1)
le(s(z0), s(z1)) → le(z0, z1)
le(s(z0), 0) → false
le(p(s(z0)), z0) → le(z0, z0)
le(0, z0) → true
Tuples:

MINUS(z0, z1) → c4(IF(le(z0, z1), z0, z1), LE(z0, z1))
LE(s(z0), s(z1)) → c5(LE(z0, z1))
IF(false, z0, z1) → c2(MINUS(p(z0), z1))
S tuples:

MINUS(z0, z1) → c4(IF(le(z0, z1), z0, z1), LE(z0, z1))
LE(s(z0), s(z1)) → c5(LE(z0, z1))
IF(false, z0, z1) → c2(MINUS(p(z0), z1))
K tuples:none
Defined Rule Symbols:

p, if, minus, le

Defined Pair Symbols:

MINUS, LE, IF

Compound Symbols:

c4, c5, c2

(9) CdtUsableRulesProof (EQUIVALENT transformation)

The following rules are not usable and were removed:

if(false, z0, z1) → s(minus(p(z0), z1))
if(true, z0, z1) → 0
minus(z0, z1) → if(le(z0, z1), z0, z1)
le(p(s(z0)), z0) → le(z0, z0)

(10) Obligation:

Complexity Dependency Tuples Problem
Rules:

le(s(z0), s(z1)) → le(z0, z1)
le(s(z0), 0) → false
le(0, z0) → true
p(0) → s(s(0))
p(s(z0)) → z0
Tuples:

MINUS(z0, z1) → c4(IF(le(z0, z1), z0, z1), LE(z0, z1))
LE(s(z0), s(z1)) → c5(LE(z0, z1))
IF(false, z0, z1) → c2(MINUS(p(z0), z1))
S tuples:

MINUS(z0, z1) → c4(IF(le(z0, z1), z0, z1), LE(z0, z1))
LE(s(z0), s(z1)) → c5(LE(z0, z1))
IF(false, z0, z1) → c2(MINUS(p(z0), z1))
K tuples:none
Defined Rule Symbols:

le, p

Defined Pair Symbols:

MINUS, LE, IF

Compound Symbols:

c4, c5, c2

(11) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)

Use narrowing to replace MINUS(z0, z1) → c4(IF(le(z0, z1), z0, z1), LE(z0, z1)) by

MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0), LE(s(z0), 0))
MINUS(0, z0) → c4(IF(true, 0, z0), LE(0, z0))

(12) Obligation:

Complexity Dependency Tuples Problem
Rules:

le(s(z0), s(z1)) → le(z0, z1)
le(s(z0), 0) → false
le(0, z0) → true
p(0) → s(s(0))
p(s(z0)) → z0
Tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
IF(false, z0, z1) → c2(MINUS(p(z0), z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0), LE(s(z0), 0))
MINUS(0, z0) → c4(IF(true, 0, z0), LE(0, z0))
S tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
IF(false, z0, z1) → c2(MINUS(p(z0), z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0), LE(s(z0), 0))
MINUS(0, z0) → c4(IF(true, 0, z0), LE(0, z0))
K tuples:none
Defined Rule Symbols:

le, p

Defined Pair Symbols:

LE, IF, MINUS

Compound Symbols:

c5, c2, c4

(13) CdtLeafRemovalProof (BOTH BOUNDS(ID, ID) transformation)

Removed 1 trailing nodes:

MINUS(0, z0) → c4(IF(true, 0, z0), LE(0, z0))

(14) Obligation:

Complexity Dependency Tuples Problem
Rules:

le(s(z0), s(z1)) → le(z0, z1)
le(s(z0), 0) → false
le(0, z0) → true
p(0) → s(s(0))
p(s(z0)) → z0
Tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
IF(false, z0, z1) → c2(MINUS(p(z0), z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0), LE(s(z0), 0))
S tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
IF(false, z0, z1) → c2(MINUS(p(z0), z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0), LE(s(z0), 0))
K tuples:none
Defined Rule Symbols:

le, p

Defined Pair Symbols:

LE, IF, MINUS

Compound Symbols:

c5, c2, c4

(15) CdtRhsSimplificationProcessorProof (BOTH BOUNDS(ID, ID) transformation)

Removed 1 trailing tuple parts

(16) Obligation:

Complexity Dependency Tuples Problem
Rules:

le(s(z0), s(z1)) → le(z0, z1)
le(s(z0), 0) → false
le(0, z0) → true
p(0) → s(s(0))
p(s(z0)) → z0
Tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
IF(false, z0, z1) → c2(MINUS(p(z0), z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
S tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
IF(false, z0, z1) → c2(MINUS(p(z0), z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
K tuples:none
Defined Rule Symbols:

le, p

Defined Pair Symbols:

LE, IF, MINUS

Compound Symbols:

c5, c2, c4, c4

(17) CdtNarrowingProof (BOTH BOUNDS(ID, ID) transformation)

Use narrowing to replace IF(false, z0, z1) → c2(MINUS(p(z0), z1)) by

IF(false, 0, x1) → c2(MINUS(s(s(0)), x1))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))

(18) Obligation:

Complexity Dependency Tuples Problem
Rules:

le(s(z0), s(z1)) → le(z0, z1)
le(s(z0), 0) → false
le(0, z0) → true
p(0) → s(s(0))
p(s(z0)) → z0
Tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
IF(false, 0, x1) → c2(MINUS(s(s(0)), x1))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))
S tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
IF(false, 0, x1) → c2(MINUS(s(s(0)), x1))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))
K tuples:none
Defined Rule Symbols:

le, p

Defined Pair Symbols:

LE, MINUS, IF

Compound Symbols:

c5, c4, c4, c2

(19) CdtLeafRemovalProof (ComplexityIfPolyImplication transformation)

Removed 1 leading nodes:

IF(false, 0, x1) → c2(MINUS(s(s(0)), x1))

(20) Obligation:

Complexity Dependency Tuples Problem
Rules:

le(s(z0), s(z1)) → le(z0, z1)
le(s(z0), 0) → false
le(0, z0) → true
p(0) → s(s(0))
p(s(z0)) → z0
Tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))
S tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))
K tuples:none
Defined Rule Symbols:

le, p

Defined Pair Symbols:

LE, MINUS, IF

Compound Symbols:

c5, c4, c4, c2

(21) CdtUsableRulesProof (EQUIVALENT transformation)

The following rules are not usable and were removed:

p(0) → s(s(0))
p(s(z0)) → z0

(22) Obligation:

Complexity Dependency Tuples Problem
Rules:

le(s(z0), s(z1)) → le(z0, z1)
le(s(z0), 0) → false
le(0, z0) → true
Tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))
S tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))
K tuples:none
Defined Rule Symbols:

le

Defined Pair Symbols:

LE, MINUS, IF

Compound Symbols:

c5, c4, c4, c2

(23) CdtRuleRemovalProof (UPPER BOUND(ADD(n^1)) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

IF(false, s(z0), x1) → c2(MINUS(z0, x1))
We considered the (Usable) Rules:none
And the Tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(0) = 0   
POL(IF(x1, x2, x3)) = x2   
POL(LE(x1, x2)) = 0   
POL(MINUS(x1, x2)) = x1   
POL(c2(x1)) = x1   
POL(c4(x1)) = x1   
POL(c4(x1, x2)) = x1 + x2   
POL(c5(x1)) = x1   
POL(false) = 0   
POL(le(x1, x2)) = 0   
POL(s(x1)) = [1] + x1   
POL(true) = 0   

(24) Obligation:

Complexity Dependency Tuples Problem
Rules:

le(s(z0), s(z1)) → le(z0, z1)
le(s(z0), 0) → false
le(0, z0) → true
Tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))
S tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
K tuples:

IF(false, s(z0), x1) → c2(MINUS(z0, x1))
Defined Rule Symbols:

le

Defined Pair Symbols:

LE, MINUS, IF

Compound Symbols:

c5, c4, c4, c2

(25) CdtKnowledgeProof (BOTH BOUNDS(ID, ID) transformation)

The following tuples could be moved from S to K by knowledge propagation:

MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))

(26) Obligation:

Complexity Dependency Tuples Problem
Rules:

le(s(z0), s(z1)) → le(z0, z1)
le(s(z0), 0) → false
le(0, z0) → true
Tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))
S tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
K tuples:

IF(false, s(z0), x1) → c2(MINUS(z0, x1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
Defined Rule Symbols:

le

Defined Pair Symbols:

LE, MINUS, IF

Compound Symbols:

c5, c4, c4, c2

(27) CdtRuleRemovalProof (UPPER BOUND(ADD(n^2)) transformation)

Found a reduction pair which oriented the following tuples strictly. Hence they can be removed from S.

LE(s(z0), s(z1)) → c5(LE(z0, z1))
We considered the (Usable) Rules:none
And the Tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))
The order we found is given by the following interpretation:
Polynomial interpretation :

POL(0) = [1]   
POL(IF(x1, x2, x3)) = [2]x2 + [2]x2·x3 + x22   
POL(LE(x1, x2)) = [2]x2   
POL(MINUS(x1, x2)) = [2] + [2]x1 + [2]x2 + [2]x1·x2 + x12   
POL(c2(x1)) = x1   
POL(c4(x1)) = x1   
POL(c4(x1, x2)) = x1 + x2   
POL(c5(x1)) = x1   
POL(false) = [1]   
POL(le(x1, x2)) = [1] + x12   
POL(s(x1)) = [2] + x1   
POL(true) = [1]   

(28) Obligation:

Complexity Dependency Tuples Problem
Rules:

le(s(z0), s(z1)) → le(z0, z1)
le(s(z0), 0) → false
le(0, z0) → true
Tuples:

LE(s(z0), s(z1)) → c5(LE(z0, z1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
IF(false, s(z0), x1) → c2(MINUS(z0, x1))
S tuples:none
K tuples:

IF(false, s(z0), x1) → c2(MINUS(z0, x1))
MINUS(s(z0), s(z1)) → c4(IF(le(z0, z1), s(z0), s(z1)), LE(s(z0), s(z1)))
MINUS(s(z0), 0) → c4(IF(false, s(z0), 0))
LE(s(z0), s(z1)) → c5(LE(z0, z1))
Defined Rule Symbols:

le

Defined Pair Symbols:

LE, MINUS, IF

Compound Symbols:

c5, c4, c4, c2

(29) SIsEmptyProof (BOTH BOUNDS(ID, ID) transformation)

The set S is empty

(30) BOUNDS(1, 1)